﻿package base.component
{
    import flash.utils.*;
    import manager.*;

    public class TimerInfo extends Object implements IPoolItem
    {
        public var id:uint;
        public var func:Function;
        public var arg:Array;

        public function TimerInfo()
        {
            return;
        }// end function

        public function init(param1:int, param2:Function, param3:Array) : void
        {
            this.id = param1;
            this.arg = param3;
            this.func = param2;
            return;
        }// end function

        public function doit() : void
        {
            if (this.func != null)
            {
                this.func.apply(null, this.arg);
                TimeOutManager.getInstance().clearTimer(this.id);
            }
            return;
        }// end function

        public function reset() : void
        {
            this.clear();
            return;
        }// end function

        public function dispose() : void
        {
            this.clear();
            return;
        }// end function

        public function clear() : void
        {
            if (this.id > 0)
            {
                clearTimeout(this.id);
                this.id = 0;
                this.arg = null;
                this.func = null;
            }
            return;
        }// end function

    }
}
